package com.example.sentinelproviderdemo.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * @author chaird
 * @create 2022-04-20 16:08
 */
@RestController
public class HelloController {

//    @GetMapping("/testA")
//    @SentinelResource(value = "testA")
//    public String testA() {
//
//        return "---------testA";
//    }

    @GetMapping("/testB")
    @SentinelResource(value = "testB",blockHandlerClass = CustomerBlockHandler.class)
    public String testB() {
        //try { TimeUnit.SECONDS.sleep(10); } catch (Exception e) { e.printStackTrace(); } finally { }
        
        return "---------testB" + LocalDateTime.now();
    }
}